Microsoft acquired the Norwegian enterprise search
company FAST Search & Transfer on April 25, 2008. This was the
largest enterprise infrastructure acquisition ever made by Microsoft.
The product acquired has now been released as part of the SharePoint
2010 product family. And just like any other technology, before you can
start to automate administrative tasks, you need to understand the
technology you are trying to automate. Because this section’s topic is
how to use Windows PowerShell with
FAST Search Server 2010 for SharePoint, rather than an explanation of
FAST Search Server 2010 for SharePoint.
Briefly, when FAST Search
Server for SharePoint is installed, it adds additional servers to your
existing SharePoint Server topology, plus it installs software on
servers that run SharePoint Server. FAST Search Server for SharePoint
consists of the following three main parts.
Servers that run
FAST Search Server for SharePoint. This includes at least two servers.
One is a server designated as a FAST Search Server (back-end), which
runs services such as query matching, indexing, and document/item
processing; the other is a server for monitoring FAST Search. One of the
FAST back-end servers runs the administrative services. The admin
server must be configured and running before you can add one or more
non-admin servers to a multiple server deployment.
FAST
Query Search Service Application (SSA) installed on the SharePoint
Server Web server to provide query Web Parts, integration capabilities,
and query capabilities by using the query object model to talk to the
FAST back-end for query matching and processing.
FAST
Content Search Service Application (SSA) installed on a SharePoint
Server application server, where it replaces a portion of the crawler so
that it can retrieve content that it then sends to the FAST back-end
server for indexing.
There are several options that allow you to manage a FAST Search Server for SharePoint installation. These include
The SharePoint 2010 Central Administration website
The administration pages can be found by navigating from Central
Administration to Applications Management to Manage Service
Applications, where you click the SSA you want to manage. You then can
administer content sources and crawl rules as you do with SharePoint
Server enterprise search. In the navigation area at left, you also can
click FAST Search Administration to administer the management of crawled
and managed properties, property extraction, and spell checking. Not
all server-related administrative tasks can be completed using these Web
pages, however.
FAST Search Windows PowerShell cmdlets
These can be used for specific administrator tasks, including uploading
a compiled dictionary to the resource store, creating a security user
store, and mapping metadata to indexable fields. Just as there is a
management shell for SharePoint Server, so there is a management shell
for FAST Search for SharePoint.
FAST Search administrative executable commands These commands, such as nctrl, allow you to manage a FAST node.
The FAST Search Site Administration feature
This allows you to delegate management of FAST search keywords, user
contexts, and site promotion and demotion to users who own the content.
This is the easiest way to tune relevance.
Note:
Learning to use Windows PowerShell with
FAST Search Server for SharePoint is more important than knowing how to
use it to manage other aspects of SharePoint Server, because some
administrative operations can only be performed by cmdlets or other
command-line tools.
The following sections cover these topics related to FAST Search.
Using the FAST Search Server 2010 for SharePoint Shell
cmdlets for FAST Search Server for SharePoint 2010
Adding FAST Search Server for SharePoint 2010 to a SharePoint 2010 Installation
FAST Search
Site Administration provides three links under Site Collection
Administration on the Site Settings page. These links are FAST Search
keywords, FAST Search site promotion and demotion, and FAST Search user
context. For these links to be available, the Searchextensions
feature must be enabled at the site collection level. Like many
features scoped at the site collection or site (web) level, you might
want to activate or deactivate the feature on many site collections or
sites through your farm, depending on specific criteria. In a farm with
many site collections or sites, it could take a considerable amount of
time to complete this task using the browser. An alternative is to get a
developer to create a small program that would automate the task, but
another alternative provides an example of how Windows PowerShell can
minimize the amount of time needed to complete such a task.
The SharePoint Server
Enterprise Site Collection feature, also known as PremiumSite, is not
visible through the browser. It is activated when the Searchextensions
feature is activated; that is, Searchextensions is a hidden feature that
cannot be activated from the Site Collection Administration Features
page, but it can be activated using Windows PowerShell. Use the
following script to activate the Searchextensions feature for all site
collections within a Web application.
$SiteScope = Start-SPAssignment; Foreach ($Site in ($SiteScope | Get-SPSite -webappl http://intranet.contoso.msft)) { if (!(Get-SPFeature searchextensions -site $Site.Url ` -ErrorAction SilentlyContinue;)) { Write-Host "Enabling feature for site collection" $Site.Url; Enable-SPFeature "searchextensions" -Url $Site.Url; } } Stop-SPAssignment $SiteScope;
You can develop a
similar script to deactivate the Searchextensions feature, and you can
add other criteria to return only site collections within
a specific Web application. When activating features scoped at the site
(web) level, for example, you could filter the site returned to include
only blog sites.
|
1. Using the FAST Search Server 2010 for SharePoint Shell
You can access the FAST Search
Server 2010 for SharePoint shell by clicking Start, selecting Programs,
and then selecting Microsoft FAST Search Server 2010 For SharePoint.
Then select Microsoft FAST Search Server 2010 For SharePoint. A review
of the properties of the shortcut exposes following the command.
C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe -NoExit " &
' C:\FASTSearch\\installer\scripts\shell\FastSearch.ps1 ' "
The Windows PowerShell profile file, FastSearch.ps1, contains the following code, plus a signature.
Add-PSSnapin AdminSnapIn
Add-PSSnapin Microsoft.FASTSearch.PowerShell
$FASTSEARCH = [environment]::GetEnvironmentVariable("FASTSEARCH","Machine")
$path = Join-Path -path $FASTSEARCH -childPath "bin"
$envpath = Join-Path -path $FASTSEARCH -childpath "etc"
Update-FormatData -AppendPath "$envpath\FASTSearch.Format.ps1xml"
cd $path
This profile file completes the following tasks.
Adds two Windows PowerShell snap-ins so you have access to the new FAST Search Server for SharePoint cmdlets.
Obtains the environment variable %FASTSEARCH%
that contains the drive and folder where the FAST Search Server for
SharePoint files were installed and stores the information in a
variable, $path.
Creates a variable, $envpath, to store the folder %FASTSEARCH%\foldername.
This variable is then used to reload the formatting data from the XML
file FASTSearch.Format.ps1xml. The Format.ps1xml files in Windows
PowerShell define the default display of objects in Windows PowerShell.
To find out more about this file, type Get-Help about_Format.ps1xml in a Windows PowerShell console.
Change the current directory to %FASTSEARCH%\bin.
This allows you to use the management shell to run FAST Search
administration programs that live in the bin directory, such as psconfig
and nctl, without specifying a path for them.
Note:
The environment variable %FASTSEARCH% was created when FAST
Search Server for SharePoint 2010 was installed, and by default the
installation location is C:\FASTSEARCH. This folder and its subfolders
contain a number of Windows PowerShell scripts that you can find by
searching for .ps1, mostly in the %FASTSEARCH%\installer\scripts
directory. You might consider adding this folder to the environment
variable %PATH%,
especially during the installation process. To have this directory
added to the path variable every time you start the management shell,
add the following lines to the profile file.
$ScriptPath = Join-Path -Path $FASTSEARCH -ChildPath "installer\scripts";
$env:path += "; $ScriptPath";
Note:
SECURITY ALERT
For some tasks, you will need to start the Microsoft FAST Search Server
2010 for SharePoint Shell as an administrator, such as when you
complete the post-installation tasks. To do this, right-click Microsoft
FAST Search Server 2010 For SharePoint and then select Run As
Administrator.
When the FAST Search Server
2010 for SharePoint shell is started, you may receive an error message
that says “FastSearch.ps1 cannot be loaded because the execution of
scripts is disabled on this system,” as shown in Figure 1.
If this happens, complete the following procedure.
Close the management shell.
Right-click
the Microsoft FAST Search Server 2010 For SharePoint shortcut and then
click Run As Administrator. You will then see the error message “Cannot
be loaded.”
Type the following command and answer Y when prompted.
Set-ExecutionPolicy RemoteSigned
You will see output similar to the following.
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust.
Changing the execution policy might expose you to the security risks described
in the about_Execution_Policies help topic. Do you want to change the execution
policy?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
Close the management shell and then reopen it.
Note:
You must run the command
Set-ExecutionPolicy as an administrator because it alters the registry
key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell.